import Vue from 'vue'
import App from './App'
import VueResource from 'vue-resource'
import md5 from 'js-md5'

Vue.prototype.$md5 = md5
Vue.use(VueResource)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})

app.$mount()
Vue.prototype.setData = function(obj) {
	let that = this;
	Object.keys(obj).forEach(function(key) {
		if(key.indexOf(".")!=-1){
			var keyList = key.split(".")
			var keyS = that.$data
			for(var i = 0 ; i<keyList.length-1;i++){
				keyS=keyS[keyList[i]]
			}
			that.$set(keyS, keyList[keyList.length-1], obj[key])
		}else{
			that.$set(that.$data, key, obj[key])
		}
	});
}

